package com.jake.searchmatch.controller;

import com.jake.searchmatch.mapper.CollegeMapper;
import com.jake.searchmatch.mapper.UniversityMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("universities")
public class UniversityController {

    @Autowired
    private UniversityMapper universityMapper;

    @Autowired
    private CollegeMapper collegeMapper;

    @GetMapping
    public List<String> getAllUniversities() {
        return universityMapper.getAllUniversities();
    }

    @GetMapping("{uid}/colleges")
    public List<String> getCollegesByUid(@PathVariable Integer uid) {
        return collegeMapper.getCollegesByUid(uid);
    }
}
